package com.ruoyi.project.mahjong.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.system.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mahjong.mapper.SendMoneyMapper;
import com.ruoyi.project.mahjong.domain.SendMoney;
import com.ruoyi.project.mahjong.service.ISendMoneyService;

/**
 * 取款记录Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-01
 */
@Service
public class SendMoneyServiceImpl implements ISendMoneyService
{
    @Autowired
    private SendMoneyMapper sendMoneyMapper;

    /**
     * 查询取款记录
     *
     * @param id 取款记录ID
     * @return 取款记录
     */
    @Override
    public SendMoney selectSendMoneyById(Long id)
    {
        return sendMoneyMapper.selectSendMoneyById(id);
    }

    /**
     * 查询取款记录列表
     *
     * @param sendMoney 取款记录
     * @return 取款记录
     */
    @Override
    public List<SendMoney> selectSendMoneyList(SendMoney sendMoney)
    {
        return sendMoneyMapper.selectSendMoneyList(sendMoney);
    }

    /**
     * 新增取款记录
     *
     * @param sendMoney 取款记录
     * @return 结果
     */
    @Override
    public int insertSendMoney(SendMoney sendMoney)
    {
        sendMoney.setCreateTime(DateUtils.getNowDate());
        SysUser user = SecurityUtils.getLoginUser().getUser();
        sendMoney.setCreateBy(user.getUserId().toString());
        return sendMoneyMapper.insertSendMoney(sendMoney);
    }

    /**
     * 修改取款记录
     *
     * @param sendMoney 取款记录
     * @return 结果
     */
    @Override
    public int updateSendMoney(SendMoney sendMoney)
    {
        sendMoney.setUpdateTime(DateUtils.getNowDate());
        return sendMoneyMapper.updateSendMoney(sendMoney);
    }

    /**
     * 批量删除取款记录
     *
     * @param ids 需要删除的取款记录ID
     * @return 结果
     */
    @Override
    public int deleteSendMoneyByIds(Long[] ids)
    {
        return sendMoneyMapper.deleteSendMoneyByIds(ids);
    }

    /**
     * 删除取款记录信息
     *
     * @param id 取款记录ID
     * @return 结果
     */
    @Override
    public int deleteSendMoneyById(Long id)
    {
        return sendMoneyMapper.deleteSendMoneyById(id);
    }
}
